package com.acane.instagram.controller;

import com.acane.instagram.pojo.Result;
import com.acane.instagram.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    private FollowService followService;

    @GetMapping("/history")
    public Result getFollowHistory(@RequestParam String userId) {
        return followService.getFollowHistory(userId);
    }

    @PostMapping("")
    public Result follow(@RequestParam String followingId, @RequestParam String followerId) {
        return followService.follow(followingId, followerId);
    }

    @PostMapping("unFollow")
    public Result unFollow(@RequestParam String followingId, @RequestParam String followerId) {
        return followService.unFollow(followingId, followerId);
    }

    @GetMapping("/follower/list")
    public Result getFollowerList(@RequestParam String userId) {
        return followService.getFollowerList(userId);
    }

    @GetMapping("/following/list")
    public Result getFollowingList(@RequestParam String userId) {
        return followService.getFollowingList(userId);
    }
}